Normalize backend schedule contract - #22
Conversation
There was a problem hiding this comment.
💡 Codex Review
solverforge-ui/js-src/10-backend.js
Lines 105 to 106 in a12ce3e
createSolver.start() now rejects any non-string id in js-src/11-solver.js:27-30, but the Tauri adapter still returns the raw invoke() result here. If a Tauri command returns {id: ...}, {jobId: ...}, or a numeric id—the same shapes resolveJobId() now accepts for HTTP and that the README documents—the solve flow now fails immediately with Invalid solver backend createSchedule response and never opens the event stream.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| listen(eventName, function (event) { | ||
| onMessage(event.payload); | ||
| var payload = event && event.payload ? event.payload : {}; | ||
| if (resolveEventJobId(payload) !== targetId) return; | ||
| onMessage(payload); |
There was a problem hiding this comment.
Don't unconditionally drop Tauri events without top-level ids
This filter discards every Tauri update whose job id is not exposed in one of the top-level fields that resolveEventJobId() knows about. That breaks backends that emit id-less updates for a single active run, and even payload.data.id payloads, which isEventForCurrentJob() in js-src/11-solver.js still treats as valid. In those setups the UI never receives live progress or the final NOT_SOLVING event, so the solver appears to hang until it is manually stopped.
Useful? React with 👍 / 👎.
| if (typeof content === 'string') { | ||
| target.textContent = content; | ||
| } else if (content && content.unsafeHtml) { |
There was a problem hiding this comment.
Make
unsafeBody actually render trusted HTML
unsafeBody is now the documented escape hatch for modal HTML, but this helper still sends all plain strings through textContent. As a result, SF.createModal({ unsafeBody: '<b>x</b>' }) shows literal tags instead of markup, and the only working path is an undocumented { unsafeHtml: ... } wrapper object.
Useful? React with 👍 / 👎.
Summary
createScheduleresponses into a stable string job id contract.createSolver()from starting with invalid/malformed schedule responses.